﻿<%@ Page Title="" Language="C#" MasterPageFile="ReconSite.Master" AutoEventWireup="true" CodeBehind="CustomerRemitterAccountMaster.aspx.cs" Inherits="Recon.Portal.WebUI.CustomerRemitterAccountMaster" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleHolder" runat="server">
    <title>Customer Account Master</title>
</asp:Content>
<asp:Content ID="BodyContent" ContentPlaceHolderID="BodyHolder" runat="server">
    <div class="formDiv" style="width: 72%">
        <h2 class="formTitle">Customer Account Master</h2>
        <h1 class="formError" style="text-align: right; font-size: smaller; color: #CC2900;">Fields marked with * are mandatory</h1>
        <%--<span id="mandatoryMessage" class="formError">Fields marked with * are mandatory</span>--%>
        <table cellspacing="1" cellpadding="1" border="0" width="100%">
            
           
            <tr>
                <td align="right" style="width: 18%">Account Number</td>
            <td colspan="3">

                <asp:TextBox ID="txtAccountNumber" runat="server" MaxLength="20"></asp:TextBox>
                <asp:RequiredFieldValidator ID="reqAccountNumber" runat="server"
                    ErrorMessage="Account Number is mandatory" CssClass="formError"
                    ControlToValidate="txtAccountNumber" SetFocusOnError="True"></asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="regAccountNumber" runat="server"
                    ErrorMessage="Enter Valid Account Number." CssClass="formError"
                    ControlToValidate="txtAccountNumber" SetFocusOnError="True"
                    ValidationExpression="^[a-zA-Z0-9]{1,20}$"></asp:RegularExpressionValidator>
            </td>
            </tr>


            <tr>
                <td align="right" style="width: 18%; padding-bottom: 12px">Account Name
                </td>
                <td colspan="3">
                    <asp:TextBox ID="txtAccountName" runat="server" MaxLength="50"></asp:TextBox>
                    &nbsp;<asp:RegularExpressionValidator ID="regAccountName" runat="server"
                        ErrorMessage="Invalid Account Name" CssClass="formError"
                        ControlToValidate="txtAccountName" SetFocusOnError="True"
                        ValidationExpression="^[a-zA-Z0-9' '.]{1,50}$"></asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <td align="right" style="width: 18%; padding-bottom: 12px">Bank ID<span class="required">*</span>
                </td>
                <td colspan="3">

                    <asp:DropDownList ID="ddlBankId" runat="server" Width="300">
                        <asp:ListItem Value="0">Please Select Bank Id</asp:ListItem>
                    </asp:DropDownList>
                    <asp:RequiredFieldValidator ID="reqBankId" runat="server"
                        ErrorMessage="Select Bank ID." CssClass="formError"
                        ControlToValidate="ddlBankId" SetFocusOnError="True"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td align="right">&nbsp;
                </td>
                <td colspan="3">
                    <asp:Button ID="btnSubmit" runat="server" Text="Add" OnClick="btnSubmit_Click" />&nbsp;
                <asp:Button ID="btnCancel" runat="server" Text="Reset" CausesValidation="False" OnClick="btnCancel_Click" />
                </td>
            </tr>
        </table>
        <br />
        <br />
        
         <div style="height:380px; width:900px; overflow:auto;">
                <asp:GridView ID="gvCustAccount" runat="server" AllowPaging="false" 
                        AutoGenerateColumns="False" Width="850"
                        HeaderStyle-BackColor="silver" HeaderStyle-ForeColor="#6f788f" 
                            HeaderStyle-Font-Bold="false"                     
                    OnRowDeleting="gvCustAccount_RowDeleting"   >
                    <EmptyDataTemplate>
                        <asp:Label ID="lblNoRows" runat="server" Text="No records found for customer account detail." />
                    </EmptyDataTemplate>
                    <Columns>
                        <asp:TemplateField HeaderText="" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:LinkButton  ID = "lnkSelect" runat="server"  Text = "Select"  CausesValidation="false" CommandName="Select"></asp:LinkButton>
                            </ItemTemplate>
                          </asp:TemplateField>
                        <asp:TemplateField HeaderText="Customer Id" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:Label  ID = "lblCustomerID" runat="server" Text='<%# Eval("CustID") %>' ></asp:Label>
                            </ItemTemplate>
                          </asp:TemplateField>
                        <%-- <asp:TemplateField HeaderText="Customer Id" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:LinkButton  ID = "lnkSelect" runat="server"  Text = '<%# Eval("CustID") %>' CausesValidation="false" CommandName="Select"></asp:LinkButton>
                            </ItemTemplate>
                          </asp:TemplateField>--%>
                        <%--<asp:TemplateField>
                            <ItemTemplate>
                                <asp:Label  ID = "lblCustID" runat="server" Text='<%# Eval("CustID") %>' ></asp:Label>
                            </ItemTemplate>
                          </asp:TemplateField>--%>
                        <asp:TemplateField HeaderText="Account No" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:Label  ID = "lblAccountNo" runat="server" Text='<%# Eval("AccountNumber") %>' ></asp:Label>
                            </ItemTemplate>
                          </asp:TemplateField>
                        <asp:TemplateField HeaderText="Account Name" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:Label  ID = "lblAccountName" runat="server" Text='<%# Eval("AccountName") %>' ></asp:Label>
                            </ItemTemplate>
                          </asp:TemplateField>
                        <asp:TemplateField HeaderText="Bank Id" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <asp:Label  ID = "lblBankId" runat="server" Text='<%# Eval("BankID") %>' ></asp:Label>
                            </ItemTemplate>
                          </asp:TemplateField>
                        <%--OnRowCancelingEdit="gvCustAccount_RowCancelingEdit" OnRowEditing="gvCustAccount_RowEditing" OnRowUpdating="gvCustAccount_RowUpdating"--%> 
                        <%--<asp:CommandField HeaderText="Edit-Update" ShowEditButton="True" CausesValidation="false" ItemStyle-HorizontalAlign="Center" />--%>
                       <%-- <asp:CommandField HeaderText="Select" ShowSelectButton="true" CausesValidation="false" ItemStyle-HorizontalAlign="Center"  />--%>
                        <%--<asp:BoundField HeaderText="Customer Id" DataField="CustID" HeaderStyle-Font-Bold = "false" ItemStyle-HorizontalAlign="Center" ReadOnly="True"/>--%>
                       <%-- <asp:BoundField HeaderText="Account Number" DataField="AccountNumber" HeaderStyle-Font-Bold = "false" ItemStyle-HorizontalAlign="Center" ReadOnly="True"/>
                        <asp:BoundField HeaderText="Account Name" DataField="AccountName" HeaderStyle-Font-Bold = "false" ItemStyle-HorizontalAlign="Center"/>--%>
                        <%--<asp:BoundField HeaderText="Bank Id" DataField="BankID" HeaderStyle-Font-Bold = "false" ItemStyle-HorizontalAlign="Center" ReadOnly="True"/>--%>
                        <asp:CommandField HeaderText="Delete" ShowDeleteButton="True" ItemStyle-HorizontalAlign="Center" />
                    </Columns>
                </asp:GridView>
          </div>

        <asp:UpdatePanel ID="upUnmatchedLists" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <div id="pnlMatchList" runat="server" class="pnlMatchList">
                    <span style="azimuth: center;">
                        <div id="Div1" class="formDiv" runat="server">
                            <center>
                                <asp:Label ID="lblMessage" runat="server" CssClass="lable" />
                            </center>
                        </div>
                    </span>
                    <div class="formDiv" style="width: 30%;">
                        <center>
                            <asp:Button ID="btnok" runat="server" Text="OK" OnClick="btnok_Click" CausesValidation="False" />
                        </center>
                    </div>
                </div>
                <div style="display: none">
                    <asp:Button ID="btnManualPopup" runat="server" />
                </div>
                <ajax:ModalPopupExtender ID="btnClickPopup" runat="server" PopupControlID="pnlMatchList"
                    TargetControlID="btnManualPopup" BackgroundCssClass="modalBackground" RepositionMode="RepositionOnWindowScroll" OkControlID="btnok">
                </ajax:ModalPopupExtender>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>

    <script type="text/javascript" language="javascript">
     
        $(function () {
            $("[id*=lnkSelect]").click(function () {
                //var accounNo = $('table[id*="gvCustAccount"] [id*="lblAccountNo"]').text();
                //var accounName = $('table[id*="gvCustAccount"] [id*="lblAccountName"]').text();
                var tr = $(this).closest('tr');
                var accounNo = $(tr).find('span[id*="lblAccountNo"]').text();
                var accounName = $(tr).find('span[id*="lblAccountName"]').text();
                var bankId = $(tr).find('span[id*="lblBankId"]').text();
                //alert(accounNo + ',' + accounName + ',' + bankId);
                //var bankId = $('table[id*="gvCustAccount"] [id*="lblBankId"]').text();
                //var accounNo = $(this).closest('table').find('[id*=lblAccountNo]').val();
                //var accountName = $(this).closest('table').find('[id*=lblAccountName]').val();
                //var total = parseInt(price) * parseInt(quantity);
                //$(e.target).closest('tr').find("[id*=lblTotal]").text(total);

                //var currentRow = $(this).closest('table');
                //alert('Please select Bank Name.' + accounNo + '   Name ' );
                $("#<%= txtAccountNumber.ClientID %>").val(accounNo).text();
                $("#<%= txtAccountName.ClientID %>").val(accounName).text();
                $("#<%= ddlBankId.ClientID %>").val(bankId).text();

                var btntext = "Modify";
                $("#<%= btnSubmit.ClientID %>").val(btntext).text();
                return false;
            });
        });

        //function ShowConfirm() {
        //    var elem = $(this).closest('.item');

        //    $.confirm({
        //        'title': "Please Confirm",
        //        'message': "Are sure to delete this?",
        //        'buttons': {
        //            OkBtnCaption: {
        //                'class': 'blue',
        //                'action': function () { $("[id*=lnkSelect]").click(); },
        //                'id': 'okBtn'
        //            },
        //            CancelBtnCaption: {
        //                'class': 'gray',
        //                'action': function () { },
        //                'id': 'cancelBtn'
        //            }
        //        }
        //    });
        //    return false;
        //}

  </script>

</asp:Content>
